<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>MPush Message Sender</title>
</head>
<body>
<form onsubmit="return false;">
    <label>
        sessionId:
        <input type="text" value="1" id="sessionId" required="required" style="width: 100%">
    </label>
    <label>
        senderId:
        <input type="text" value="user-0" id="senderId" required="required" style="width: 100%">
    </label>
    <label>
        senderName:
        <input type="text" value="user-0" id="senderName" required="required" style="width: 100%">
    </label>
    
     <label>
        type:
        <input type="text" value="0" id="type" required="required" style="width: 100%">
    </label>
    <label>
        msgContent:
        <input type="text" value="你好!" id="msgContent" required="required" style="width: 100%">
    </label>
    <label>
        seq:
        <input type="text" value="123456789" id="seq" required="required" style="width: 100%">
    </label>
   
    <br/>
   
    <input type="button" value="Send To Client" style="width: 100%" onclick="send()">
</form>
<script type="application/javascript">
    function $(id) {
        return document.getElementById(id);
    }

    function send() {
        var sessionId = $('sessionId').value;
        var senderId = $('senderId').value;
        var senderName = $('senderName').value;
        var type = $('type').value;
        var msgContent = $('msgContent').value;
        var seq = $('seq').value;

        var xhr = new XMLHttpRequest();
        xhr.open('POST', '/push', true);
        xhr.setRequestHeader("context-type", "application/json; charset=utf-8");

        xhr.onload = function (e) {
            if (this.status == 200) {
                alert(this.response)
            }
        };

        xhr.send(JSON.stringify({
        		sessionId: sessionId,
        		senderId: senderId,
        		senderName: senderName,
        		type: type,
        		msgContent:msgContent,
        		seq:seq
        }));
    }
</script>
</body>
</html>



